package com.heima.utils.common;

import com.heima.model.wemedia.pojos.WmUser;

public class WmThreadLocalUtil {
    //定义ThreadLocal对象
    private final static ThreadLocal<WmUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();

    // 添加数据到ThreadLocal

    public static void add(WmUser wmUser){
        WM_USER_THREAD_LOCAL.set(wmUser);
    }

    // 从ThreadLocal中获取数据
    public static WmUser get(){
        return WM_USER_THREAD_LOCAL.get();
    }

    // 清空ThreadLocal中的数据
    public static void remove(){
        WM_USER_THREAD_LOCAL.remove();
    }
}
